package com.grass.p019lv.activity;

import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.grass.p019lv.databinding.ActivitySearchLabelBinding;
import com.grass.p019lv.fragment.SearchLabelFragment;
import com.gyf.immersionbar.ImmersionBar;

/* renamed from: com.grass.lv.activity.SearchLabelActivity */
public class SearchLabelActivity extends BaseActivity<ActivitySearchLabelBinding> {
    Adapter adapter;
    SearchLabelFragment hotFragment;
    String info;
    SearchLabelFragment newFragment;
    private int position;

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return R.layout.activity_search_label;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        ((ActivitySearchLabelBinding) this.binding).setClick(new OnClick());
        ((ActivitySearchLabelBinding) this.binding).setPosition(Integer.valueOf(this.position));
        ((ActivitySearchLabelBinding) this.binding).f1955vp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            /* class com.grass.p019lv.activity.SearchLabelActivity.C28941 */

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageScrollStateChanged(int i) {
            }

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageScrolled(int i, float f, int i2) {
            }

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageSelected(int i) {
                ((ActivitySearchLabelBinding) SearchLabelActivity.this.binding).setPosition(Integer.valueOf(i));
            }
        });
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivitySearchLabelBinding) this.binding).toolbar).init();
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initData() {
        super.initData();
        String stringExtra = getIntent().getStringExtra("data");
        this.info = stringExtra;
        this.newFragment = SearchLabelFragment.newInstance(1, stringExtra);
        this.hotFragment = SearchLabelFragment.newInstance(2, this.info);
        this.adapter = new Adapter(getSupportFragmentManager(), 1);
        ((ActivitySearchLabelBinding) this.binding).f1955vp.setAdapter(this.adapter);
        TextView textView = ((ActivitySearchLabelBinding) this.binding).tvTitle;
        textView.setText("#" + this.info);
    }

    /* renamed from: com.grass.lv.activity.SearchLabelActivity$Adapter */
    class Adapter extends FragmentStatePagerAdapter {
        @Override // androidx.viewpager.widget.PagerAdapter
        public int getCount() {
            return 2;
        }

        private Adapter(FragmentManager fragmentManager, int i) {
            super(fragmentManager, i);
        }

        @Override // androidx.fragment.app.FragmentStatePagerAdapter
        public Fragment getItem(int i) {
            if (i == 0) {
                return SearchLabelActivity.this.newFragment;
            }
            return SearchLabelActivity.this.hotFragment;
        }
    }

    /* renamed from: com.grass.lv.activity.SearchLabelActivity$OnClick */
    public class OnClick {
        public OnClick() {
        }

        public void btnBack() {
            SearchLabelActivity.this.finish();
        }

        public void selectPosition(int i) {
            SearchLabelActivity.this.position = i;
            ((ActivitySearchLabelBinding) SearchLabelActivity.this.binding).f1955vp.setCurrentItem(SearchLabelActivity.this.position);
            ((ActivitySearchLabelBinding) SearchLabelActivity.this.binding).setPosition(Integer.valueOf(SearchLabelActivity.this.position));
        }
    }
}
